//
//  AXMyWdjsSchemeDetailsSecondCell.m
//  AnXin100
//
//  Created by 天质弘耕 on 2018/11/8.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "AXMyWdjsSchemeDetailsSecondCell.h"
#import "UIView+SDAutoLayout.h"
#import "ZXCategories.h"
#import "UITableView+SDAutoTableViewCellHeight.h"

@implementation AXMyWdjsSchemeDetailsSecondCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self creatView];
        [self setlayout];
    }
    return self;
}

- (void)creatView {
    
    self.productImgView = [[UIImageView alloc]init];
    self.productImgView.cornerRadius = 5;
    self.productImgView.image = [UIImage imageNamed:@"ptyz.jpg"];
    [self.contentView addSubview:self.productImgView];
    
    self.questionLabel = [[UILabel alloc]init];
    self.questionLabel.font = FONT_FOURTEEN;
    self.questionLabel.textColor = COLOR_Gray;
    [self.contentView addSubview:self.questionLabel];
    
    self.answerTitleLabel = [[UILabel alloc]init];
    self.answerTitleLabel .font = FONT_FOURTEEN;
    self.answerTitleLabel .textColor = COLOR_DIV;
    self.answerTitleLabel .text = @"诊断结果";
    [self.contentView addSubview:self.answerTitleLabel ];
    
    self.answerContentLabel = [[UILabel alloc]init];
    self.answerContentLabel.font = FONT_FOURTEEN;
    self.answerContentLabel.textColor = COLOR_Gray;
    [self.contentView addSubview:self.answerContentLabel];
}

- (void)setlayout {
    
    self.productImgView.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.contentView, 5)
    .widthIs(SCREEN_WIDTH-20)
    .heightIs(SCREEN_WIDTH/2);
    
    self.questionLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.productImgView,10)
    .widthIs(SCREEN_WIDTH-20)
    .autoHeightRatio(0)
    .minHeightIs(40);
    
    self.answerTitleLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.questionLabel, 10)
    .widthIs(70)
    .heightIs(30);
    
    self.answerContentLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.answerTitleLabel, 10)
    .widthIs(SCREEN_WIDTH-20)
    .autoHeightRatio(0)
    .minHeightIs(40);
    
    [self setupAutoHeightWithBottomView:self.answerContentLabel bottomMargin:10];
    
}

- (void)setModel:(AXMyWdjsSchemeDetailModel *) mode{
    _model=mode;
    _questionLabel.text=_model.fName;
    _answerContentLabel.text=_model.fDiagnosisStrategy;
    
    
}

@end
